/** 
 * Project Name:sys-portal-Extjs 
 * File Name:MainView.js 
 * Package Name: 数据源管理界面
 * Author : 吴Yuan|小森森
 * Date:2018年7月19日下午5:16:52 
 * Copyright (c) 2018, 15909910367@163.com All Rights Reserved. 
 * 
 */
Ext.define('Jason.view.protal.module.systemSetting.dataSource.MainView', {
    extend: 'Wys.basic.BaseView',
    alternateClassName: 'dataSourceManagerView',
    itemId: 'dataSourceManagerView',
    requires: [
        'Wys.basic.BaseView',
        'Jason.view.protal.module.systemSetting.dataSource.MainCtrl',
        'Jason.view.protal.module.systemSetting.dataSource.MainViewModel',
        'Jason.store.module.systemSetting.DataSourceStore'
    ],
    viewModel: { type: 'dataSouces_MainViewModel' },
    bind: '{gridStore}',
    controller: 'dataSouceCtrl',
    xtype: 'dataSourceManagerView',
    selType: 'checkboxmodel',
    multiSelect: true,
    enabledMark: false,
    dockedItems: [{
        xtype: 'pagingtoolbar',
        enabledMoreOpt: true,
        bind: '{gridStore}',
        dock: 'bottom'
    }, {
        xtype: 'toolbar',
        dock: 'top',
        items: [
            {
                xtype: 'segmentedbutton', items: [
                    {
                        xtype: 'previewbutton',
                        rightCode: 'RIGHTMANAGER'
                    }, {
                        xtype: 'newbutton',
                        enabledMoreNew: true,
                        rightCode: 'RIGHTMANAGER'
                    }, {
                        xtype: 'editbutton',
                        rightCode: 'RIGHTMANAGER'
                    }, {
                        xtype: 'deletebutton',
                        rightCode: 'RIGHTMANAGER'
                    }
                ]
            },
            "->", { xtype: 'refresh', viewItemId: '#dataSourceManagerView' }, {
                xtype: 'exportbutton', rightCode: 'RIGHTMANAGER',
                modularText: '数据源管理'
            }
        ]
    }],
    columns: [
        { text: 'ID', flex: 1, sortable: true, dataIndex: 'id', align: 'left', hidden: true },
        {
            text: '程序调用节点', width: 100, sortable: true, dataIndex: 'useName', align: 'left', renderer: function (v, m) {
                m.style = "font-weight:bold";
                return v;
            }
        },
        { text: '数据源名称', flex: 1, sortable: true, dataIndex: 'title', align: 'left' },
        { text: '驱动类名', flex: 2, minWidth: 150, sortable: true, dataIndex: 'driverClassName', align: 'left', hidden: true },
        { text: '连接字符串', flex: 2, sortable: true, dataIndex: 'urlAddition', align: 'left', hidden: true },
        {
            text: '数据库类型', width: 90, sortable: true, dataIndex: 'dataBaseType', align: 'center', renderer: function (v) {
                return '<div class="custom-tag custom-tag-info">' + v + '</div>';
            }
        },
        { text: '用户名', flex: 2, sortable: true, dataIndex: 'userName', align: 'left', hidden: true },
        { text: '连接密码', flex: 2, sortable: true, dataIndex: 'password', align: 'left', hidden: true },
        { text: '连接描述', flex: 2, sortable: true, dataIndex: 'linkRemark', align: 'left', hidden: true },
        { text: '数据源描述', flex: 2, sortable: true, dataIndex: 'dbRemark', align: 'left', hidden: true },
        { text: 'IP地址', width: 100, sortable: true, dataIndex: 'ipAddress', align: 'left' },
        { text: '端口号', width: 60, sortable: true, dataIndex: 'portNumber', align: 'left' },
        { text: '数据库名称', width: 100, sortable: true, dataIndex: 'defaultSchema', align: 'left' },
        { text: '创建时间', width: 130, sortable: true, dataIndex: 'createDate', align: 'center', xtype: 'datecolumn', format: 'Y-m-d H:i' },
        { text: '最近修改时间', width: 130, sortable: true, dataIndex: 'lastModifyDate', align: 'center', xtype: 'datecolumn', format: 'Y-m-d H:i' }
    ]
});